/**
 * @param {number[][]} accounts
 * @return {number}
*/
var maximumWealth = function(accounts) {
  let result = [];
  for(let i = 0; i < accounts.length; i++) {
    result.push(accounts[i].reduce((preValue, curValue) => {
      return preValue + curValue;
    }));
  }
  return Math.max(...result);
};
let accounts = [[1,2,3],[3,2,1]];
console.log(maximumWealth(accounts));
accounts = [[1,5],[7,3],[3,5]];
console.log(maximumWealth(accounts));
accounts = [[2,8,7],[7,1,3],[1,9,5]];
console.log(maximumWealth(accounts));
